Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Create color variables file, update Fonts (test) - #184

Open
josephco wants to merge 4 commits into
masterfrom
new-color-map
Open

Create color variables file, update Fonts (test)#184
josephco wants to merge 4 commits into
masterfrom
new-color-map

Conversation

@josephco

@josephco josephco commented Nov 11, 2016

Copy link
Copy Markdown
Contributor

This is intended to eventually replace our use of the color map and Accoutrement color() function.

I've added the new color variables as an additional file so that we can start experimenting with them now, and fully transition if/when we see fit.

Storing our colors as CSS variables is especially useful as they are easily previewed and changed in the inspector, without having to find or remember hex values:

screen shot 2016-11-11 at 4 00 56 pm

Please note that our stack values no longer include the --light descriptor, and simply start from a base --gray and then sequence from --gray1 to --gray9 etc.

Usage examples:

background-color: var(--dark-blue);
color: var(--dark-text);
border: 1px solid var(--border);

I have not implemented any IE fallbacks, so this will only work in all other modern browsers. There is an official postcss module that will convert any values scoped to the :root {}, which is fine for these colors, but not so flexible if we want to scope variables within blocks or media queries (https://github.com/postcss/postcss-custom-properties). A less popular postcss module claims to be more flexible, but doesn't quite meet the spec (https://github.com/MadLittleMods/postcss-css-variables).

More on CSS variables (custom properties):

https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables
https://developers.google.com/web/updates/2016/02/css-variables-why-should-you-care

@josephco
josephco force-pushed the new-color-map branch 2 times, most recently from bb25dba to ec29006 Compare December 13, 2016 18:58
@josephco josephco changed the title Create color variables file Create color variables file, update Fonts (test) Dec 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant